// 主容器
.mock-auth-container {
  display: flex;
  gap: 12px;
  padding: 12px;
  min-height: calc(100vh - 120px);
}

// 左侧面板
.left-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 400px;
}

// 右侧面板
.right-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 400px;
}

// 卡片样式
.server-status-card,
.request-history-card,
.quick-login-card,
.login-form-card,
.auth-status-card,
.token-management-card,
.operation-history-card {
  background: white;
  border-radius: 6px;
  padding: 12px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
  border: 1px solid #e0e0e0;

  h3 {
    margin: 0 0 10px 0;
    color: #333;
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
  }
}

// Mock Server 状态
.server-status-card {
  .status-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 10px;

    .status-item {
      display: flex;
      justify-content: space-between;
      align-items: center;

      .label {
        font-weight: 500;
        color: #666;
      }

      .value {
        font-weight: 600;
        color: #333;

        &.running {
          color: #4caf50;
        }
      }
    }
  }

  .stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;

    .stat-item {
      text-align: center;
      padding: 8px;
      background: #f8f9fa;
      border-radius: 4px;

      .stat-number {
        font-size: 1.2rem;
        font-weight: bold;
        color: #333;

        &.success {
          color: #4caf50;
        }

        &.error {
          color: #f44336;
        }
      }

      .stat-label {
        font-size: 0.7rem;
        color: #666;
        margin-top: 2px;
      }
    }
  }
}

// 请求历史
.request-history-card {
  flex: 1;
  overflow: hidden;

  .request-list {
    max-height: 500px;
    overflow-y: auto;

    .request-item {
      border: 1px solid #e0e0e0;
      border-radius: 4px;
      margin-bottom: 6px;
      padding: 8px;
      transition: all 0.2s ease;

      &:hover {
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
      }

      &.success {
        border-left: 4px solid #4caf50;
      }

      &.error {
        border-left: 4px solid #f44336;
      }

      .request-header {
        display: flex;
        align-items: center;
        gap: 6px;
        margin-bottom: 6px;
        flex-wrap: wrap;

        .method {
          padding: 2px 6px;
          border-radius: 3px;
          font-size: 0.7rem;
          font-weight: bold;
          color: white;

          &.get {
            background: #4caf50;
          }

          &.post {
            background: #2196f3;
          }

          &.put {
            background: #ff9800;
          }

          &.delete {
            background: #f44336;
          }
        }

        .url {
          font-family: 'Courier New', monospace;
          font-size: 0.8rem;
          color: #333;
          flex: 1;
          min-width: 0;
          word-break: break-all;
        }

        .status {
          padding: 2px 6px;
          border-radius: 3px;
          font-size: 0.7rem;
          font-weight: bold;

          &.success {
            background: #e8f5e8;
            color: #4caf50;
          }

          &.client-error {
            background: #ffebee;
            color: #f44336;
          }

          &.server-error {
            background: #ffebee;
            color: #f44336;
          }
        }

        .duration {
          font-size: 0.7rem;
          color: #666;
        }

        .timestamp {
          font-size: 0.7rem;
          color: #666;
        }
      }

      .request-details {
        .detail-section {
          margin-bottom: 6px;

          h5 {
            margin: 0 0 3px 0;
            font-size: 0.7rem;
            color: #666;
            font-weight: 600;
          }

          .json-content {
            background: #f8f9fa;
            border: 1px solid #e9ecef;
            border-radius: 3px;
            padding: 6px;
            font-family: 'Courier New', monospace;
            font-size: 0.65rem;
            line-height: 1.2;
            margin: 0;
            overflow-x: auto;
            white-space: pre-wrap;
            word-break: break-word;
            max-height: 80px;
            overflow-y: auto;
          }
        }
      }
    }

    .empty-state {
      text-align: center;
      padding: 40px 20px;
      color: #666;

      p {
        margin: 0;
        font-style: italic;
      }
    }
  }
}

// 快速登录
.quick-login-card {
  .user-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 8px;

    .user-card {
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 8px;
      border: 1px solid #e0e0e0;
      border-radius: 4px;
      cursor: pointer;
      transition: all 0.2s ease;

      &:hover {
        background: #f8f9fa;
        border-color: #1976d2;
      }

      .user-avatar {
        width: 32px;
        height: 32px;
        border-radius: 50%;
        object-fit: cover;
      }

      .user-info {
        flex: 1;

        .username {
          font-weight: 600;
          color: #333;
          margin-bottom: 1px;
          font-size: 0.9rem;
        }

        .role {
          font-size: 0.7rem;
          color: #666;
          margin-bottom: 1px;
        }

        .description {
          font-size: 0.65rem;
          color: #999;
        }
      }
    }
  }
}

// 登录表单
.login-form-card {
  .login-form {
    display: flex;
    flex-direction: column;
    gap: 16px;

    .form-group {
      display: flex;
      flex-direction: column;
      gap: 4px;

      label {
        font-weight: 500;
        color: #333;
      }

      input {
        padding: 8px 12px;
        border: 1px solid #ddd;
        border-radius: 4px;
        font-size: 1rem;

        &:focus {
          outline: none;
          border-color: #1976d2;
          box-shadow: 0 0 0 2px rgba(25, 118, 210, 0.2);
        }

        &.ng-invalid.ng-touched {
          border-color: #f44336;
        }
      }

      .field-error {
        color: #f44336;
        font-size: 0.8rem;
        margin-top: 4px;
        padding: 2px 4px;
      }
    }

    .error-message {
      color: #f44336;
      font-size: 0.9rem;
      padding: 8px;
      background: #ffebee;
      border-radius: 4px;
      border: 1px solid #ffcdd2;
    }
  }
}

// 认证状态
.auth-status-card {
  .status-display {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 10px;

    .status-item {
      display: flex;
      justify-content: space-between;
      align-items: center;

      .label {
        font-weight: 500;
        color: #666;
      }

      .value {
        font-weight: 600;
        color: #333;

        &.authenticated {
          color: #4caf50;
        }
      }
    }
  }

  .btn-secondary {
    background-color: #dc3545;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s;
    margin-top: 10px;

    &:hover {
      background-color: #c82333;
    }

    &:disabled {
      background-color: #6c757d;
      cursor: not-allowed;
    }
  }

  .auth-actions {
    margin-top: 12px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;

    .btn {
      padding: 6px 12px;
      font-size: 12px;
      border-radius: 4px;
      border: 1px solid #dee2e6;
      background-color: white;
      color: #495057;
      cursor: pointer;
      transition: all 0.2s;

      &:hover:not(:disabled) {
        background-color: #f8f9fa;
        border-color: #adb5bd;
      }

      &:disabled {
        opacity: 0.6;
        cursor: not-allowed;
      }
    }
  }
}

// Token 管理
.token-management-card {
  .token-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 10px;

    .token-field {
      display: flex;
      justify-content: space-between;
      align-items: center;

      label {
        font-weight: 500;
        color: #666;
      }

      .value {
        font-weight: 600;
        color: #333;

        &.valid {
          color: #4caf50;
        }

        &.invalid {
          color: #f44336;
        }
      }

      .token-content {
        background: #f8f9fa;
        padding: 8px 12px;
        border-radius: 4px;
        font-family: 'Courier New', monospace;
        font-size: 0.9rem;
        color: #333;
        border: 1px solid #e9ecef;
      }
    }
  }

  // Token 解码信息样式
  .token-decoded {
    margin-top: 0.8rem;
    padding: 0.8rem;
    background: rgba(0, 123, 255, 0.05);
    border: 1px solid rgba(0, 123, 255, 0.2);
    border-radius: 6px;

    h4 {
      margin: 0 0 0.8rem 0;
      color: #007bff;
      font-size: 1rem;
      display: flex;
      align-items: center;
      gap: 0.4rem;
    }

    .decoded-section {
      margin-bottom: 0.8rem;

      &:last-child {
        margin-bottom: 0;
      }

      h5 {
        margin: 0 0 0.4rem 0;
        color: #495057;
        font-size: 0.8rem;
        font-weight: 600;
      }

      .json-content {
        background: #f8f9fa;
        border: 1px solid #e9ecef;
        border-radius: 3px;
        padding: 0.6rem;
        font-family: 'Courier New', monospace;
        font-size: 0.7rem;
        line-height: 1.3;
        margin: 0;
        overflow-x: auto;
        white-space: pre-wrap;
        word-break: break-word;
      }

      .signature-content {
        background: #f8f9fa;
        border: 1px solid #e9ecef;
        border-radius: 4px;
        padding: 0.5rem;
        font-family: 'Courier New', monospace;
        font-size: 0.8rem;
        display: block;
        word-break: break-all;
      }

      .full-token {
        background: #f8f9fa;
        border: 1px solid #e9ecef;
        border-radius: 4px;
        padding: 0.75rem;
        font-family: 'Courier New', monospace;
        font-size: 0.7rem;
        display: block;
        word-break: break-all;
        line-height: 1.3;
        max-height: 200px;
        overflow-y: auto;
      }
    }
  }

  .token-actions {
    display: flex;
    gap: 6px;
  }
}

// 操作历史
.operation-history-card {
  flex: 1;
  overflow: hidden;

  .history-list {
    max-height: 400px;
    overflow-y: auto;

    .history-item {
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 6px 8px;
      margin-bottom: 3px;
      border-radius: 3px;
      border-left: 3px solid transparent;

      &.history-success {
        background: #e8f5e8;
        border-left-color: #4caf50;
      }

      &.history-error {
        background: #ffebee;
        border-left-color: #f44336;
      }

      &.history-info {
        background: #e3f2fd;
        border-left-color: #2196f3;
      }

      .history-time {
        font-size: 0.65rem;
        color: #666;
        min-width: 60px;
        flex-shrink: 0;
      }

      .history-action {
        font-weight: 600;
        color: #333;
        font-size: 0.8rem;
        min-width: 80px;
        flex-shrink: 0;
      }

      .history-details {
        font-size: 0.75rem;
        color: #666;
        flex: 1;
        word-break: break-all;
        line-height: 1.2;
      }
    }

    .empty-state {
      text-align: center;
      padding: 40px 20px;
      color: #666;

      p {
        margin: 0;
        font-style: italic;
      }
    }
  }
}

// 按钮样式
.btn {
  padding: 12px 24px;
  border: none;
  border-radius: 4px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;

  &:disabled {
    opacity: 0.6;
    cursor: not-allowed;
  }

  &.btn-primary {
    background: #1976d2;
    color: white;

    &:hover:not(:disabled) {
      background: #1565c0;
    }
  }

  &.btn-secondary {
    background: #6c757d;
    color: white;

    &:hover:not(:disabled) {
      background: #5a6268;
    }
  }

  &.btn-outline {
    background: transparent;
    color: #1976d2;
    border: 1px solid #1976d2;

    &:hover:not(:disabled) {
      background: #1976d2;
      color: white;
    }
  }
}

// 响应式设计
@media (max-width: 1200px) {
  .mock-auth-container {
    flex-direction: column;
  }

  .left-panel,
  .right-panel {
    min-width: unset;
  }
}

@media (max-width: 768px) {
  .mock-auth-container {
    padding: 10px;
    gap: 10px;
  }

  .server-status-card,
  .request-history-card,
  .quick-login-card,
  .login-form-card,
  .auth-status-card,
  .token-management-card,
  .operation-history-card {
    padding: 16px;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .user-grid {
    grid-template-columns: 1fr;
  }
}